<?php
class Business extends AppModel
{
	public $name = "Business";

    public $hasMany = array('Message');
    public $belongsTo = array('User' => array('className' => 'User',
                                              'conditions' => '',
                                              'order' => '',
                                              'foreignKey' => 'user_id'
                                               ),
                              'Plan' => array('className' => 'Plan',
                                              'conditions' => '',
                                              'order' => '',
                                              'foreignKey' => 'plan_id'
                                              )
                              );

                              /*'Category' => array('className' => 'Category',
                                              'conditions' => '',
                                              'order' => '',
                                              'foreignKey' => 'category'
                                              )*/


    public $validate = array('business_name' =>
                              array('rule' => 'notEmpty',
                                    'message' => 'Business name is a required field'
                                    ),
                             'street' =>
                              array('rule' => 'notEmpty',
                                    'message' => 'Street is a required field'
                                    ),
                             'city' =>
                              array('rule' => 'notEmpty',
                                    'message' => 'City is a required field'
                                    ),
                             'State' =>
                              array('rule' => 'notEmpty',
                                    'message' => 'State is a required field'
                                    ),
                             'postal' =>
                              array('postalRule-1' =>
                                     array('rule' => 'numeric',
                                           'message' => 'Enter a valid postal code'
                                           ),
                                    'postalRule-2' =>
                                     array('rule' => 'notEmpty',
                                           'message' => 'Postal code is a required field'
                                    ),
                                ),
                             'contact_no' =>
                              array('rule' => 'notEmpty',
                                    'message' => 'Contact number is a required field'
                                    )
                             );
}
?>